<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	template="/xhtml/templates/layout.xhtml">

	<ui:define name="title">#{msgs.Bibliotheque_tabTitle}</ui:define>

	<ui:define name="entete">
		<h:form id="enteteForme" styleClass="container-vertically-centered">
			<p:toolbar id="enteteTolBar">
				<p:toolbarGroup id="enteteTolBarGroup" align="left">
					<h:outputText value="#{msgs.Bibliotheque_title}" style="text-align: center;" />
				</p:toolbarGroup>
			</p:toolbar>
		</h:form>
	</ui:define>

	<ui:define name="bibliotheque_optionButton">
		<h:form id="bibliotheque_optionButtonForme" styleClass="container-vertically-centered">
			<p:toolbar id="enteteTolBar">
				<p:toolbarGroup id="enteteTolBarGroup" align="center">

					<p:menubar autoSubmenuDisplay="true">
						<p:submenu label="#{msgs.Bibliotheque_submenu1}" icon="ui-icon ui-icon-search">
							<p:menuitem value="#{msgs.Bibliotheque_menuitem1}" action="#{manageBeanOuvrage.toSearch}" ajax="false"/>
							<p:menuitem value="#{msgs.Bibliotheque_menuitem2}" action="#{manageBeanUtilisateur.toSearch}" ajax="false"/>
						</p:submenu>
						
						<p:submenu label="#{msgs.Bibliotheque_submenu2}" icon="ui-icon ui-icon-gear">
							<p:menuitem value="#{msgs.Bibliotheque_menuitem4}" action="vueOuvrage.xhtml" disabled="#{!request.isUserInRole('admin')}" ajax="false"/>
							<p:menuitem value="#{msgs.Bibliotheque_menuitem5}" action="vueUtilisateur.xhtml" disabled="#{!request.isUserInRole('admin')}" ajax="false"/>
						</p:submenu>
						</p:menubar>
						
				</p:toolbarGroup>
			</p:toolbar>
		</h:form>
	</ui:define>

	<ui:define name="bibliotheque_table">
		<h:form id="bibliotheque_tableForme" styleClass="container-vertically-centered">
			<p:dataTable id="bibliotheque_tableDatatTable" var="ouvrage" value="#{manageBeanOuvrage.service.allRecherche}" paginator="true" rows="5" rowKey="#{ouvrage.key}"
				selection="#{manageBeanOuvrage.selectedOuvrage}" selectionMode="single"
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				rowsPerPageTemplate="5,10,15">  
				<p:ajax event="rowSelect" update="bibliotheque_informationLivreForm"/>
				 
				<f:facet name="header">
					<h:outputText value="#{msgs.Bibliotheque_outputTextHeader}" />
				</f:facet>

				<p:column headerText="#{msgs.Bibliotheque_headerText1}">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{ouvrage.codeIsbn}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{ouvrage.codeIsbn}" style="width: 100px;" label="Code isbn" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="#{msgs.Bibliotheque_headerText2}">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{ouvrage.titre}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{ouvrage.titre}" style="width: 130px;" label="Titre" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="#{msgs.Bibliotheque_headerText3}">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{ouvrage.auteur}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{manageBeanOuvrage.service.modifAuteur}" style="width: 130px;" label="Auteur" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="#{msgs.Bibliotheque_headerText4}">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{ouvrage.genre}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{manageBeanOuvrage.service.modifGenre}" style="width: 130px;" label="Genre" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="#{msgs.Bibliotheque_headerText5}">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{ouvrage.genrePublic}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{manageBeanOuvrage.service.modifGenrePublic}" style="width: 143px;" label="Public" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="#{msgs.Bibliotheque_headerText6}">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{ouvrage.provenance}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{manageBeanOuvrage.service.modifProvenance}" label="Provenance" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				
				<p:column headerText="#{msgs.Bibliotheque_headerText7}" >
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{ouvrage.emprunter}" style="color:#{ouvrage.emprunter le true ? 'red' : 'blue'}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{manageBeanOuvrage.service.modifEmprunter}" style="width: 100px;" label="Emprunter" />
						</f:facet>
					</p:cellEditor>					
				</p:column>

				<p:column headerText="#{msgs.Bibliotheque_headerText8}" rendered="#{request.isUserInRole('admin')}">
					<p:rowEditor />
					<p:commandButton oncomplete="edit.show()" update="dialogForm" value="Edit"  />
				</p:column>

				<f:facet name="footer">
					<h:outputText value="#{msgs.Bibliotheque_outputTextFooter}" />					
				</f:facet>
			</p:dataTable>
			
		</h:form>
	</ui:define>

	<ui:define name="popoInformationOuvrage">
		<h:form id="dialogForm" styleClass="container-vertically-centered">
			<p:growl id="msgs" />
			<p:dialog id="dialogId" header="Basic Dialog" widgetVar="edit" showEffect="explode" hideEffect="explode" height="260" width="710">
				<h:panelGrid id="bibliotheque_informationLivreGrid" columns="2">
					<h:panelGroup>
						<h:panelGrid id="a" columns="2" border="4" cellpadding="2">

							<h:outputText value="#{msgs.Bibliotheque_popoInformationOuvrageOutputTex1}" />
							<p:inplace editor="true" onEditUpdate="msgs">
								<p:inputText value="#{manageBeanOuvrage.selectedOuvrage.codeIsbn}" style="width: 100px;" label="Code isb" required="true" />
							</p:inplace>
							<h:outputText value="#{msgs.Bibliotheque_popoInformationOuvrageOutputTex2}" />
							<p:inplace editor="true">
								<p:inputText value="#{manageBeanOuvrage.service.modifTitre}" style="width: 100px;" label="Titre" required="true" />
							</p:inplace>
							<h:outputText value="#{msgs.Bibliotheque_popoInformationOuvrageOutputTex3}" />
							<p:inplace editor="true" onEditUpdate="msgs">
								<p:inputText value="#{manageBeanOuvrage.service.modifDessinateur}" style="width: 100px;" label="Dessinateur" required="true" />
							</p:inplace>
							<h:outputText value="#{msgs.Bibliotheque_popoInformationOuvrageOutputTex4}" />
							<p:inplace editor="true" onEditUpdate="msgs">
								<p:inputText value="#{manageBeanOuvrage.service.modifAuteur}" style="width: 100px;" label="Auteur" required="true" />
							</p:inplace>
							<h:outputText value="#{msgs.Bibliotheque_popoInformationOuvrageOutputTex5}" />
							<p:inplace editor="true" onEditUpdate="msgs">
								<p:inputText value="#{manageBeanOuvrage.service.modifEditeur}" style="width: 100px;" label="Editeur" required="true" />
							</p:inplace>
							<h:outputText value="#{msgs.Bibliotheque_popoInformationOuvrageOutputTex6}" />
							<p:inplace editor="true" onEditUpdate="msgs">
								<p:inputText value="#{manageBeanOuvrage.service.modifNbPages}" style="width: 100px;" label="Nombre de pages" required="true" />
							</p:inplace>
							<h:outputText value="#{msgs.Bibliotheque_popoInformationOuvrageOutputTex7}" />
							<p:inplace editor="true" onEditUpdate="msgs">
								<p:inputText value="#{manageBeanOuvrage.service.modifGenre}" style="width: 100px;" label="Genre" required="true" />
							</p:inplace>

						</h:panelGrid>
					</h:panelGroup>
					<h:panelGroup>
						<h:panelGrid id="b" columns="2" border="4" cellpadding="3">

							<h:outputText value="#{msgs.Bibliotheque_popoInformationOuvrageOutputTex8}" />
							<p:inplace editor="true" onEditUpdate="msgs">
								<p:inputText value="#{manageBeanOuvrage.service.modifGenrePublic}" style="width: 100px;" label="Genre de publique" required="true" />
							</p:inplace>
							<h:outputText value="#{msgs.Bibliotheque_popoInformationOuvrageOutputTex9}" />
							<p:inplace editor="true" onEditUpdate="msgs">
								<p:inputText value="#{manageBeanOuvrage.service.modifProvenance}" style="width: 100px;" label="Provenance" required="true" />
							</p:inplace>
							<h:outputText value="#{msgs.Bibliotheque_popoInformationOuvrageOutputTex10}" />
							<p:inplace editor="true" onEditUpdate="msgs">
								<p:inputText value="#{manageBeanOuvrage.service.modifParution}" style="width: 100px;" label="Parution" required="true" />
							</p:inplace>
							<h:outputText value="#{msgs.Bibliotheque_popoInformationOuvrageOutputTex11}" />
							<p:inplace editor="true" onEditUpdate="msgs">
								<p:inputText value="#{manageBeanOuvrage.service.modifEmprunter}" style="width: 100px;" label="Emprunter" required="true" />
							</p:inplace>
							<h:outputText value="#{msgs.Bibliotheque_popoInformationOuvrageOutputTex12}" />
							<p:inplace editor="true" onEditUpdate="msgs">
								<p:inputText value="#{manageBeanOuvrage.service.modifDatePret}" style="width: 100px;" label="Date de pret" required="true" />
							</p:inplace>
							<h:outputText value="#{msgs.Bibliotheque_popoInformationOuvrageOutputTex13}" />
							<p:inplace editor="true" onEditUpdate="msgs">
								<p:inputText value="#{manageBeanOuvrage.service.modifArendreLe}" style="width: 100px;" label="A rendre le" required="true" />
							</p:inplace>
						</h:panelGrid>
					</h:panelGroup>
				</h:panelGrid>

				<p:commandButton value="#{msgs.Bibliotheque_popoInformationOuvrageCommandButton}" url="http://localhost:8080/ExamenBibliothequePresentation/faces/xhtml/Bibliotheque.xhtml" ajax="false" />

			</p:dialog>
		</h:form>
	</ui:define>

	<ui:define name="test">
		<h:form id="testForm" styleClass="container-vertically-centered">
			<p:dialog id="testId" header="Basic Dialog" widgetVar="testDialog" showEffect="explode" hideEffect="explode" height="260" width="710">
				<h:panelGrid id="bibliotheque_informationLivreGrid" columns="2">

				</h:panelGrid>

				<p:commandButton action="#{manageBeanPret.add}" value="Emprunter" ajax="false" />

			</p:dialog>
		</h:form>
	</ui:define>

	<ui:define name="bibliotheque_separation">
		<h:form id="bibliotheque_separationForm" styleClass="container-vertically-centered">
			
			<p:separator id="separator1" title="test" style="margin-top: 3em; weight: 500px; height: 20px;"/>
		
		</h:form>
	</ui:define>

	
	<ui:define name="bibliotheque_informationLivre">
		<h:form id="bibliotheque_informationLivreForm" styleClass="container-vertically-centered">
		    <p:fieldset legend="#{msgs.Bibliotheque_fieldset}">
		    <h:panelGrid id="bibliotheque_informationLivreGrid" styleClass="bibliotheque_informationLivre" columns="2">
				<h:panelGroup>
				
					<h:panelGrid id="informationLivreGrid" columns="3" border="4" cellpadding="2">
						
						<h:outputLabel for="codeISBN" value="#{msgs.Bibliotheque_informationOuvrageOutputLabel1}" />
						<h:outputText id="codeISBN" value="#{manageBeanOuvrage.selectedOuvrage.codeIsbn}" style="font-style: oblique; color: #C2A385; margin-left: 50px; margin-right: 50px;" />
						<p:message id="msgCodeISBN" for="codeISBN" />

						<h:outputLabel for="titre" value="#{msgs.Bibliotheque_informationOuvrageOutputLabel2}" />
						<h:outputText id="titre" value="#{manageBeanOuvrage.selectedOuvrage.titre}" style="font-style: oblique; color: #C2A385; margin-left: 50px; margin-right: 50px;" />
						<p:message id="msgTitre" for="titre" />
					
						<h:outputLabel for="dessinateur" value="#{msgs.Bibliotheque_informationOuvrageOutputLabel3}" />
						<h:outputText id="dessinateur" value="#{manageBeanOuvrage.selectedOuvrage.dessinateur}" style="font-style: oblique; color: #C2A385; margin-left: 50px; margin-right: 50px;" />
						<p:message id="msgDessinateur" for="dessinateur" />
					
						<h:outputLabel for="auteur" value="#{msgs.Bibliotheque_informationOuvrageOutputLabel4}" />
						<h:outputText id="auteur" value="#{manageBeanOuvrage.selectedOuvrage.auteur}" style="font-style: oblique; color: #C2A385; margin-left: 50px; margin-right: 50px;" />
						<p:message id="msgAuteur" for="auteur" />
						
						<h:outputLabel for="editeur" value="#{msgs.Bibliotheque_informationOuvrageOutputLabel5}" />
						<h:outputText id="editeur" value="#{manageBeanOuvrage.selectedOuvrage.editeur}" style="font-style: oblique; color: #C2A385; margin-left: 50px; margin-right: 50px;" />
						<p:message id="msgEditeur" for="editeur" />
						
						<h:outputLabel for="nBpages" value="#{msgs.Bibliotheque_informationOuvrageOutputLabel6}" />
						<h:outputText id="nBpages" value="#{manageBeanOuvrage.selectedOuvrage.nbPages}" style="font-style: oblique; color: #C2A385; margin-left: 50px; margin-right: 50px;" />
						<p:message id="msgNbPages" for="nBpages" />
						
						<h:outputLabel for="genre" value="#{msgs.Bibliotheque_informationOuvrageOutputLabel7}" />
						<h:outputText id="genre" value="#{manageBeanOuvrage.selectedOuvrage.genre}" style="font-style: oblique; color: #C2A385; margin-left: 50px; margin-right: 50px;" />
						<p:message id="msgGenre" for="genre" />
						
					</h:panelGrid>					
				</h:panelGroup>
				
				<h:panelGroup>
					<h:panelGrid id="informationLivreGrid2" columns="3" border="4" cellpadding="3">

						<h:outputLabel for="public" value="#{msgs.Bibliotheque_informationOuvrageOutputLabel8}" />
						<h:outputText id="public" value="#{manageBeanOuvrage.selectedOuvrage.genrePublic}" style="font-style: oblique; color: #C2A385; margin-left: 50px; margin-right: 50px;" />
						<p:message id="msgPublic" for="public" />
						
						<h:outputLabel for="provenance" value="#{msgs.Bibliotheque_informationOuvrageOutputLabel9}" />
						<h:outputText  id="provenance" value="#{manageBeanOuvrage.selectedOuvrage.provenance}" style="font-style: oblique; color: #C2A385; margin-left: 50px; margin-right: 50px;" />
						<p:message id="msgProvenance" for="provenance" />
						
						<h:outputLabel for="parution" value="#{msgs.Bibliotheque_informationOuvrageOutputLabel10}" />
						<h:outputText id="parution" value="#{manageBeanOuvrage.selectedOuvrage.parution}" style="font-style: oblique; color: #C2A385; margin-left: 50px; margin-right: 50px;" />
						<p:message id="msgParution" for="parution" />
						
						<h:outputLabel for="emprunter" value="#{msgs.Bibliotheque_informationOuvrageOutputLabel11}" />
						<h:outputText id="emprunter" value="#{manageBeanOuvrage.selectedOuvrage.emprunter}" style="font-style: oblique; color: #C2A385; margin-left: 50px; margin-right: 50px;" />
						<p:message id="msEmprunter" for="emprunter" />
		
						<h:outputLabel for="datePret" value="#{msgs.Bibliotheque_informationOuvrageOutputLabel12}" />
						<h:outputText id="datePret" value="#{manageBeanOuvrage.selectedOuvrage.datePret}" style="font-style: oblique; color: #C2A385; margin-left: 50px; margin-right: 50px;" />
						<p:message id="msgDatePret" for="datePret" />
		
						<h:outputLabel for="aRendreLe" value="#{msgs.Bibliotheque_informationOuvrageOutputLabel13}" />
						<h:outputText id="aRendreLe" value="#{manageBeanOuvrage.selectedOuvrage.arendreLe}" style="font-style: oblique; color: #C2A385; margin-left: 50px; margin-right: 50px;" />
						<p:message id="msgnArendreLe" for="aRendreLe" />
						
					</h:panelGrid>	
								
				</h:panelGroup>	
				
			</h:panelGrid>
				</p:fieldset>	
		 </h:form>
	</ui:define>

	<ui:define name="pieddepage">
		<h:form id="pieddepageForm" styleClass="container-vertically-centered">
			<p:toolbar id="pieddepageTolBar">
				<p:toolbarGroup id="pieddepageTolBarGroup" align="left">
					<h:outputText value="#{msgs.Bibliotheque_underTitle}" />
				</p:toolbarGroup>
			</p:toolbar>
		</h:form>
	</ui:define>

</ui:composition>